import Vue from 'vue'
import VueRouter from 'vue-router'

Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    redirect: '/home'
  },
  {
    path: '/home',
    name: 'Home',
    component: () => import('../views/HomeView.vue'),
    redirect:'/index',
    children:[
      {
        path: '/index',
        name: 'Index',
        component: () => import('@/components/index/IndexView.vue')
      },
      {
        path: '/cate',
        name: 'Cate',
        component: () => import('@/components/category/CateView.vue')
      },
      {
        path: '/detail',
        name: 'Detail',
        component: () => import('@/components/Detail/DetailView.vue')
      },
      {
        path: '/sub',
        name: 'Sub',
        component: () => import('@/components/category/subCate')
      },
      {
        path: '/cart',
        name: 'Cart',
        component: () => import('@/components/cart/CartView.vue')
      },
      {
        path: '/member/checkout',
        name: 'Member',
        component: () => import('@/components/member/MemberView')
      },
    ]
  },
  {
    path: '/login',
    name: 'Login',
    component: () => import('../views/LoginView.vue')
  },
  {
    path: '/login/callback',
    name: 'Callback',
    component: () => import('../views/login/LoginCallback')
  },
  {
    path: '/about',
    name: 'about',
    component: () => import('../views/AboutView.vue')
  },
  {
    path: '/none',
    name: 'None',
    component: () => import('../views/NoneView.vue')
  }
]

const router = new VueRouter({
  // mode: 'history',
  base: process.env.BASE_URL,
  routes,
  scrollBehavior(){
    return {x:0,y:0}
  }
})

export default router
